package cn.tedu.sp04.feign;

import cn.tedu.sp01.pojo.User;
import cn.tedu.web.util.JsonResult;
import org.springframework.stereotype.Component;

@Component
public class UserClientFb implements UserClient {
    @Override
    public JsonResult<User> getUser(Integer userId) {
        if (Math.random()>0.5){
            return JsonResult.err().ok().data(new User(userId,"缓存用户名","缓存密码"));
        }
        return JsonResult.err().msg("获取用户失败");
    }

    @Override
    public JsonResult<?> addScore(Integer userId, Integer score) {
        return JsonResult.err().msg("用户积分增加失败");
    }
}
